Skip to content

sample(app): add Firestore, Database & Storage demos to sample app#2406

Open
demolaf wants to merge 21 commits into
version-10.0.0-beta04from
sample/firestore-database-storage
Open

sample(app): add Firestore, Database & Storage demos to sample app#2406
demolaf wants to merge 21 commits into
version-10.0.0-beta04from
sample/firestore-database-storage

Conversation

@demolaf

@demolaf demolaf commented Jul 20, 2026

Copy link
Copy Markdown
Member

Adds demo activities for Realtime Database, Firestore, and Storage to the sample app.

  • Move Auth demo activities into an auth/ subpackage; add database/, firestore/, storage/ subpackages
  • Add DatabaseDemoActivity — paginated list via FirebaseRecyclerPagingAdapter + orderByChild
  • Add FirestoreDemoActivity — paginated list via FirestorePagingAdapter + orderBy, seeded with a WriteBatch
  • Add StorageDemoActivity — loads gs:// URLs via Glide, both as a raw string (StringLoader) and via StorageReference
  • Wire up Realtime Database, Firestore, and Auth emulator toggles in MainActivity

Preview

sample-demo.webm

demolaf and others added 18 commits June 17, 2026 16:43
…2383)

* fix(auth): validate display name only when required in sign-up form

* fix(auth): use locale-safe matcher for sign-up button in test
# Conflicts:
#	app/src/main/AndroidManifest.xml
#	app/src/main/java/com/firebaseui/android/demo/MainActivity.kt
#	app/src/main/java/com/firebaseui/android/demo/auth/HighLevelApiDemoActivity.kt
#	storage/build.gradle.kts

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request restructures the demo application by modularizing the Auth demos and introducing new demonstration activities for Firebase Realtime Database, Firestore, and Storage (using Glide). It also updates FirestorePagingSource to properly handle InterruptedException and avoid undeliverable RxJava exceptions. Feedback focuses on several key improvements: configuring and initializing the Realtime Database emulator, exposing and passing the emulator mode to the Auth chooser screen, resolving a bug in the Storage demo where Glide loads are triggered on every keystroke, programmatically converting dp to pixels for view holder padding to avoid raw pixel anti-patterns, and optimizing Firestore data seeding using a WriteBatch.

Comment thread app/src/main/java/com/firebaseui/android/demo/MainActivity.kt
Comment thread app/src/main/java/com/firebaseui/android/demo/MainActivity.kt
Comment thread app/src/main/java/com/firebaseui/android/demo/storage/StorageDemoActivity.kt Outdated
Comment thread app/src/main/java/com/firebaseui/android/demo/MainActivity.kt Outdated
@demolaf demolaf changed the title Sample/firestore database storage sample(app): add Firestore, Database & Storage demos to sample app Jul 21, 2026
@demolaf
demolaf marked this pull request as ready for review July 21, 2026 13:14
@demolaf
demolaf marked this pull request as draft July 21, 2026 14:27
@demolaf
demolaf marked this pull request as ready for review July 21, 2026 16:31
@demolaf demolaf added the sample label Jul 22, 2026
@demolaf
demolaf force-pushed the version-10.0.0-beta04 branch from d382bd5 to 1ecd498 Compare July 22, 2026 22:13

@russellwheatley russellwheatley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions and nits on the demo additions below.

This branch also carries an unrelated commit (d382bd5, the sign-up display name validation fix) that doesn't belong here, likely from being stacked on another branch. Worth rebasing it out before merge, same ask as on the edge-to-edge insets PR.

var pendingEmailLink = intent.getStringExtra(EmailLinkConstants.EXTRA_EMAIL_LINK)
if (USE_FIRESTORE_EMULATOR) {
FirebaseFirestore.getInstance()
.useEmulator(FIRESTORE_EMULATOR_HOST, FIRESTORE_EMULATOR_PORT)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This runs on every onCreate(), including activity recreation (e.g. rotation), but useEmulator() can only be called once per FirebaseFirestore/FirebaseDatabase instance before first use, so a second call throws IllegalStateException. Worth guarding this with a one-time flag or moving it to Application.onCreate().


if (USE_DATABASE_EMULATOR) {
FirebaseDatabase.getInstance()
.useEmulator(DATABASE_EMULATOR_HOST, DATABASE_EMULATOR_PORT)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue here for the Database emulator call.


import android.os.Bundle
import android.util.Log
import com.firebaseui.android.demo.R

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import landed mid-block instead of alphabetically. Minor, but worth fixing if there's a lint/spotless pass anyway.

import com.firebase.ui.auth.ui.screens.AuthSuccessUiContext
import com.firebase.ui.auth.ui.screens.FirebaseAuthScreen
import com.firebase.ui.auth.util.EmailLinkConstants
import com.firebaseui.android.demo.R

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same unsorted import here.


<activity
android:name=".HighLevelApiDemoActivity"
android:name="com.firebaseui.android.demo.auth.HighLevelApiDemoActivity"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses the fully-qualified activity name while the other moved auth activities (e.g. .auth.CredentialLinkingDemoActivity below) use the shorter relative style. Worth picking one convention for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants